import projectRequest from "./request";
import type {UserLoginDTO} from "../interface/UserInterface";
import {UserPageDTO} from "../interface/UserInterface";

/**
 * 时间：2024年2月28日 11点41分
 * 关于用户的访问请求
 */
export function loginApi(data:UserLoginDTO) {
  return projectRequest.request({
    url:"/user/login",
    method:"post",
    data
  });
}

/**
 * 增加用户(注册)
 * @param data
 */
export function addUserApi(data:any) {
  return projectRequest.request({
    url:"/user/insert",
    method:"post",
    data
  });
}
//根据用户id获取用户详情
export function getUserDetailsByIdApi(userId:number) {
  return projectRequest.request({
    url:`/user/${userId}`,
    method:"get",
  });
}

/**
 * 分页多条件查询用户
 */
export function getUserListByPage(params:UserPageDTO) {
  return projectRequest.request({
    method:"get",
    url:"/user/page",
    params
  })
}
